/*
 * Copyright (c) 2018.
 * http://www.ulabcare.com
 */

package com.mt.roll.upms.params;

import com.mt.roll.core.enums.HttpMethodEnum;
import com.mt.roll.core.enums.MenuCategoryEnum;
import com.mt.roll.core.enums.MenuTypeEnum;
import com.mt.roll.core.base.BaseParam;
import com.mt.roll.core.validator.constraints.Enum;
import com.mt.roll.core.validator.groups.AddGroup;
import com.mt.roll.core.validator.groups.UpdateGroup;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
 * <p>
 * 菜单表
 * </p>
 *
 * @author jiff
 * @date 2018/11/9
 * @since 1.0
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "菜单", description = "用于新增和更新菜单信息")
public class MenuParam extends BaseParam {

    private static final long serialVersionUID = 1L;

    /**
     * 主键，自增
     */
    @ApiModelProperty(value = "主键，更新时需要填写", example = "1")
    @NotNull(message = "菜单ID不能为空", groups = {UpdateGroup.class})
    private Long id;

    /**
     * 父菜单ID
     */
    @ApiModelProperty(value = "父菜单ID", required = true, example = "0")
    @NotNull(message = "父菜单ID不能为空", groups = {AddGroup.class})
    @Min(message = "父菜单ID不能小于0", value = 0, groups = {AddGroup.class})
    private Long parentId;

    /**
     * 菜单编码
     */
    @ApiModelProperty(value = "菜单编码", example = "menu")
    private String code;

    /**
     * 菜单名称
     */
    @ApiModelProperty(value = "菜单名称", required = true, example = "菜单管理")
    @NotBlank(message = "菜单名称不能为空")
    private String name;

    /**
     * 菜单图标
     */
    @ApiModelProperty("菜单图标")
    private String icon;

    /**
     * 链接地址，可以是页面地址，也可以是函数事件
     */
    @ApiModelProperty("链接地址，可以是页面地址，也可以是函数事件")
    private String href;

    /**
     * 请求地址，可以用于前端ajax调用，后端用于做权限控制
     */
    @ApiModelProperty("请求地址，可以用于前端ajax调用，后端用于做权限控制")
    private String url;

    /**
     * 请求类型：GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS, TRACE
     */
    @ApiModelProperty(value = "请求类型：GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS, TRACE", example = "post")
    @Enum(message = "非法的请求类型", target = {HttpMethodEnum.class})
    private String method;

    /**
     * 权限，可以有多个，用逗号分隔，可用于第三方权限框架扩展
     */
    @ApiModelProperty("权限，可以有多个，用逗号分隔，可用于第三方权限框架扩展")
    private String permission;

    /**
     * 分类:1、pc，2、app，3、wechat，4、miniapp
     */
    @ApiModelProperty(value = "分类:1、pc，2、app，3、wechat，4、miniapp", required = true, example = "1")
    @NotNull(message = "菜单分类不能为空", groups = {AddGroup.class})
    @Enum(message = "非法的菜单分类", target = {MenuCategoryEnum.class}, groups = {AddGroup.class})
    private Integer category;


    /**
     * 类型:1、module，2、menu，3、button
     */
    @ApiModelProperty(value = "类型:1、module，2、menu，3、button", required = true, example = "1")
    @NotNull(message = "菜单类型不能为空")
    @Enum(message = "非法的菜单类型", target = {MenuTypeEnum.class})
    private Integer type;

    /**
     * 显示顺序
     */
    @ApiModelProperty(value = "显示顺序", example = "1")
    private Integer orderNum;

    /**
     * 备注
     */
    @ApiModelProperty("备注")
    private String remark;


}
